Skip to content

gh-89509: Fix "truthy"/"falsy" in documentation - #158663

Open
pochmann wants to merge 4 commits into
python:mainfrom
pochmann:patch-5
Open

pochmann wants to merge 4 commits into
python:mainfrom
pochmann:patch-5

Conversation

@pochmann

@pochmann pochmann commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Same issue as previously, just new cases. Python terminology is true/false, not truthy/falsy, as can be seen here:

Truth Value Testing
Boolean Operations — and, or, not
The if statement
The while statement
Boolean operations

@pochmann
pochmann requested a review from a team as a code owner October 3, 2026 16:32
@python-cla-bot

python-cla-bot Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34918368 | 📁 Comparing 701ece5 against main (83b40d0)

  🔍 Preview build  

3 files changed
± builtins/functions.html
± library/smtplib.html
± library/tkinter.html

@pochmann pochmann changed the title Fix "truthy"/"falsy" in documentation gh-89509: Fix "truthy"/"falsy" in documentation Oct 4, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Oct 4, 2026
<MISSING>

Sentinel objects are truthy and compare equal only to themselves. They are
Sentinel objects are true and compare equal only to themselves. They are

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this particular context I would say:

Suggested change
Sentinel objects are true and compare equal only to themselves. They are
Sentinel objects are true in a boolean context and compare equal only to themselves. They are

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about "Sentinel objects evaluate as true"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still unnecessary and ugly, if not even wrong. "Are/is true" is how the documentation does it.

Comment thread Doc/library/tkinter.rst
ON

Truthy values, all equal to the integer ``1``.
True values, all equal to the integer ``1``.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though True here is not marked up as being the boolean constant, I think this could still lead to confusion. Since the actual code uses 0 and 1 and not the booleans, I would rephrase this as:

All equal to ``1``, and so true in a boolean context.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we could just drop the mention of boolean altogether and just say "All equal to 1", which is in fact the case. Python programmers will know that 1 is true.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sentence describes tkinter's TRUE, YES and ON. Clearly being true is the point, and equality to 1 is a side note. I'd have to see how they're usually used, but saying only "equal to 1" might make people focus on the number value and write worse code.

Comment thread Doc/library/tkinter.rst
OFF

Falsy values, all equal to the integer ``0``.
False values, all equal to the integer ``0``.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly here.

@bedevere-app

bedevere-app Bot commented Oct 4, 2026

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@pochmann

pochmann commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

@bitdancer That's redundant and ugly. No other place does that. And nobody wrote "truthy in a boolean context", either.

@bitdancer

Copy link
Copy Markdown
Member

Exactly, truthy makes it clear you aren't talking about True, so you don't need to say "in a boolean context".

In our docs we try to make a careful distinction between true, meaning a value that is a true in a boolean context, and :const:`True` which is the actual singleton. In the cases we are considering here, just saying true or True is ambiguous, thus my suggestion for the clarifying language.

If you don't like the phrase "in a a boolean context"...I'll make alternate suggestions on the review.

@pochmann

pochmann commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Exactly, true has no styling and is lower case (except at the start of a sentence, of course), whereas True is styled as code and capitalized. That's how the documentation does it. It's not ambiguous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting changes docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants